#ifndef __I_NET_HANDLER_H__
#define __I_NET_HANDLER_H__

#define NET_EVENT_PERIOD 10

#include <zlib/eventsystem/I_EventSystem.h>
#include <zlib/eventsystem/P_Queue.h>
#include <queue>

class UnixNetVConnect;

class NetHandler : public Continuation
{
public:
	Event *trigger_event;//one thread one NetHandler

	int startEvent(int event, void *data);
	int mainEvent(int event, void *data);

	NetHandler();

	int startIO(UnixNetVConnect *vc);
	void stopIO(UnixNetVConnect *vc);

	void process_enable_list();
	void process_ready_list();

	BlockQueue<UnixNetVConnect *> read_enable_list;
	BlockQueue<UnixNetVConnect *> write_enable_list;

	NonBlockList<UnixNetVConnect *> open_connect_list;
	NonBlockList<UnixNetVConnect *> read_ready_list;
	NonBlockList<UnixNetVConnect *> write_ready_list;

};

void close_UnixNetVConnect(UnixNetVConnect *vc);

#endif //__I_NET_HANDLER_H__
